# Contributor: Francesco Colista <fcolista@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=wt
pkgver=4.8.0
pkgrel=0
pkgdesc="C++ library and application server for developing and deploying web applications"
url="https://www.webtoolkit.eu/"
arch="all"
license="GPL-2.0-only WITH openssl-exception"
depends_dev="zlib-dev boost-dev sqlite-dev mesa-dev glu-dev graphicsmagick-dev
	openssl1.1-compat-dev pango-dev fcgi-dev libpq-dev qt5-qtbase-dev libharu-dev
	harfbuzz-dev"
makedepends="$depends_dev cmake boost"
pkggroups="wt"
pkgusers="wt"
options="!check"
subpackages="$pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/emweb/wt/archive/$pkgver.tar.gz"

build() {
	CXXFLAGS="$CXXFLAGS -fpermissive" \
	cmake -B build . \
		-DCMAKE_BUILD_TYPE=None \
		-DCONNECTOR_HTTP=ON \
		-DWT_WRASTERIMAGE_IMPLEMENTATION=GraphicsMagick \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DWEBUSER=$pkgusers \
		-DWEBGROUP=$pkggroups \
		-DRUNDIR="$pkgdir"/var/run/wt \
		-DUSE_SYSTEM_SQLITE3=ON \
		-DINSTALL_EXAMPLES=ON \
		-DBUILD_EXAMPLES=OFF
	make -C build
}

package() {
	make -C build DESTDIR=$pkgdir install
	rm -rf $pkgdir/usr/cmake
	rm -rf $pkgdir/var/run
}

sha512sums="
0df6ec017398b2197034fdc937649bf583cb98f769d80f76a37ee14128189c78a2d1e27854f98d93b8a82503f61a2dd12167cb95d745fdb11f5ddc536f610015  wt-4.8.0.tar.gz
"
